// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using NSQL.DateFormats;
using NSQL.Resource;

namespace NSQL.Generator
{
    [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
    public class SqlGeneratorSettings
    {
        public bool Optimized { get; internal set; } = true;
        public IDatabaseInfo Database { get; internal set; }
        public LetterCase LetterCase { get; set; } = LetterCase.None;
        public bool BraceJoin { get; internal set; } = true;
        public bool AutoAlias { get; internal set; }
        
        public Version DatabaseVersion { get; set; }
        
        /// <summary>
        /// Indicate table and column should be delimited
        /// </summary>
        public bool Delimited { get; internal set; }

        public char? BeginDelimiter { get; set; } = '"';
        public char? EndDelimiter { get; set; } = '"';

        public CultureInfo CultureInfo
        {
            get => _cultureInfo;
            internal set => _cultureInfo = value ?? throw new ArgumentNullException(nameof(value));
        }


        public IDatetimeFormatter DatetimeFormatter { get; internal set; } = StandardDateFormatter.Instance;
        
        private CultureInfo _cultureInfo = DefaultCultureInfo;
        protected static readonly CultureInfo DefaultCultureInfo = new CultureInfo("zh-CN")
        {
            DateTimeFormat =
            {
                ShortDatePattern = "yyyy/MM/dd",
                LongTimePattern = "HH:mm:ss"
            }
        };
    }
}